package com.boot.noRepeatSubmitAop;

import com.boot.common.utils.R;
import com.boot.noRepeatSubmit.aop.NoRepeatSubmitHigh;
import org.springframework.web.bind.annotation.*;

/**
 * TODO
 *
 * @Project: springboot_my
 * @Package: com.boot.controller
 * @CreateTime: 2024-01-10  16:50
 * @Author: meikq
 * @Version: 1.0
 */
@RestController
@RequestMapping("/mytest")
public class MyTestController {


    @GetMapping("/test")
    @NoRepeatSubmitHigh(keyRule = KeyRuleEnum.USER_PATH_KEY, keys = "#name+#sex+#testVO.id")
    public R test(String name, String sex, TestVO testVO) {

        return R.ok();
    }

    @PostMapping("/testJson")
    @NoRepeatSubmitHigh(keyRule = KeyRuleEnum.USER_PATH_KEY, keys = "#node.testVO.id")
    public R testJson(@RequestBody TestVO node) {
        System.out.println(node.toString());
        return R.ok();
    }

    @PostMapping("/testformdata")
    @NoRepeatSubmitHigh(keyRule = KeyRuleEnum.USER_PATH_KEY, keys = "#name+#node.id")
    public R testformdata(TestVO node, String name) {
        System.out.println(node.toString());
        return R.ok();
    }

    @GetMapping("/testPath/{id}/{sex}")
    @NoRepeatSubmitHigh(keyRule = KeyRuleEnum.USER_PATH_KEY, keys = "#id+#node.id")
    public R testPath(@PathVariable("id") String id, @PathVariable("sex") String sex, String name, TestVO node) {

        return R.ok();
    }

}
